8 map
<char, char> solution
;
10 const string key
= "the quick brown fox jumps over the lazy dog";
12 bool solve(const string
&s
){
14 if (s
.length() != key
.length()){
17 for (int i
=0; i
<s
.length(); ++i
){
19 if (key
[i
] != ' ') return false;
21 //mapear s[i] a key[i]
22 if (m
.count(s
[i
]) > 0){ //ya estaba mapeada
23 if (m
[s
[i
]] != key
[i
]){
27 if (n
.count(key
[i
]) > 0){
28 if (n
[key
[i
]] != s
[i
]) return false;
44 for (int k
= 0; k
< cases
; ++k
){
45 if (k
>0) cout
<< endl
;
50 // cout << "Caso " << cases << endl;
51 while (getline(cin
, l
) && l
!= ""){
53 //cout << l << " - Solution: " << (solve(l)?"True":"False") << endl;
54 if (!solved
) solved
= solve(l
);
58 for (int i
=0; i
<lines
.size(); ++i
){
60 for (int j
=0; j
<s
.size(); ++j
){
61 if (s
[j
] == ' ') cout
<< " ";
63 cout
<< solution
[s
[j
]];
69 cout
<< "No solution.\n";